package com.ruoyi.ora.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ora.mapper.DeviceMessageMapper;
import com.ruoyi.ora.domain.DeviceMessage;
import com.ruoyi.ora.service.IDeviceMessageService;

/**
 * app给设备发送的消息，设备端轮训获取Service业务层处理
 * 
 * @author liuwp
 * @date 2025-06-19
 */
@Service
public class DeviceMessageServiceImpl implements IDeviceMessageService 
{
    @Autowired
    private DeviceMessageMapper deviceMessageMapper;

    /**
     * 查询app给设备发送的消息，设备端轮训获取
     * 
     * @param id app给设备发送的消息，设备端轮训获取主键
     * @return app给设备发送的消息，设备端轮训获取
     */
    @Override
    public DeviceMessage selectDeviceMessageById(Long id)
    {
        return deviceMessageMapper.selectDeviceMessageById(id);
    }

    /**
     * 查询app给设备发送的消息，设备端轮训获取列表
     * 
     * @param deviceMessage app给设备发送的消息，设备端轮训获取
     * @return app给设备发送的消息，设备端轮训获取
     */
    @Override
    public List<DeviceMessage> selectDeviceMessageList(DeviceMessage deviceMessage)
    {
        return deviceMessageMapper.selectDeviceMessageList(deviceMessage);
    }

    /**
     * 根据业务主键查询一条记录：app给设备发送的消息，设备端轮训获取
     *
     * @param deviceMessage app给设备发送的消息，设备端轮训获取
     * @return app给设备发送的消息，设备端轮训获取
     */
    @Override
    public DeviceMessage selectOneDeviceMessage(DeviceMessage deviceMessage)
    {
        return deviceMessageMapper.selectOneDeviceMessage(deviceMessage);
    }

    /**
     * 新增app给设备发送的消息，设备端轮训获取
     * 
     * @param deviceMessage app给设备发送的消息，设备端轮训获取
     * @return 结果
     */
    @Override
    public int insertDeviceMessage(DeviceMessage deviceMessage)
    {
        deviceMessage.setCreateTime(DateUtils.getNowDate());
        return deviceMessageMapper.insertDeviceMessage(deviceMessage);
    }

    /**
     * 修改app给设备发送的消息，设备端轮训获取
     * 
     * @param deviceMessage app给设备发送的消息，设备端轮训获取
     * @return 结果
     */
    @Override
    public int updateDeviceMessage(DeviceMessage deviceMessage)
    {
        return deviceMessageMapper.updateDeviceMessage(deviceMessage);
    }

    @Override
    public int updateDeviceMessageCondition(DeviceMessage deviceMessage, DeviceMessage deviceMessageCondition)
    {
        return deviceMessageMapper.updateDeviceMessageCondition(deviceMessage, deviceMessageCondition);
    }

    /**
     * 批量删除app给设备发送的消息，设备端轮训获取
     * 
     * @param ids 需要删除的app给设备发送的消息，设备端轮训获取主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMessageByIds(Long[] ids)
    {
        return deviceMessageMapper.deleteDeviceMessageByIds(ids);
    }

    /**
     * 删除app给设备发送的消息，设备端轮训获取信息
     * 
     * @param id app给设备发送的消息，设备端轮训获取主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMessageById(Long id)
    {
        return deviceMessageMapper.deleteDeviceMessageById(id);
    }

    /**
     * 条件删除app给设备发送的消息，设备端轮训获取
     *
     * @param deviceMessage app给设备发送的消息，设备端轮训获取
     * @return 结果
     */
    @Override
    public int deleteDeviceMessageByCondition(DeviceMessage deviceMessage)
    {
        return deviceMessageMapper.deleteDeviceMessageByCondition(deviceMessage);
    }

}
